package com.study.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the role database table.
 * 
 */
@Entity
@NamedQuery(name="Role.findAll", query="SELECT r FROM Role r")
public class Role implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="rol_id")
	private int rolId;

	@Column(name="rol_name")
	private String rolName;

	//bi-directional many-to-many association to Dept
	@ManyToMany(mappedBy="roles1")
	private List<Dept> depts1;

	//bi-directional many-to-many association to Permission
	@ManyToMany(mappedBy="roles")
	private List<Permission> permissions;

	//bi-directional many-to-many association to Dept
	@ManyToMany
	@JoinTable(
		name="deptrole"
		, joinColumns={
			@JoinColumn(name="rol_id")
			}
		, inverseJoinColumns={
			@JoinColumn(name="dep_id")
			}
		)
	private List<Dept> depts2;

	//bi-directional many-to-many association to User
	@ManyToMany
	@JoinTable(
		name="userrole"
		, joinColumns={
			@JoinColumn(name="rol_id")
			}
		, inverseJoinColumns={
			@JoinColumn(name="use_id")
			}
		)
	private List<User> users;

	public Role() {
	}

	public int getRolId() {
		return this.rolId;
	}

	public void setRolId(int rolId) {
		this.rolId = rolId;
	}

	public String getRolName() {
		return this.rolName;
	}

	public void setRolName(String rolName) {
		this.rolName = rolName;
	}

	public List<Dept> getDepts1() {
		return this.depts1;
	}

	public void setDepts1(List<Dept> depts1) {
		this.depts1 = depts1;
	}

	public List<Permission> getPermissions() {
		return this.permissions;
	}

	public void setPermissions(List<Permission> permissions) {
		this.permissions = permissions;
	}

	public List<Dept> getDepts2() {
		return this.depts2;
	}

	public void setDepts2(List<Dept> depts2) {
		this.depts2 = depts2;
	}

	public List<User> getUsers() {
		return this.users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

}